
##
## usage:  f = ifltrans(w, F, x)
##  
## Inverse Fouier-Laplace transform 
##
##              / 
##         1   |
## F(w) = ---  | F(w) exp(iwx) dw
##        2ipi |
##            / 
##
## Input variables:
##  F      : Data to be transformed (vector)
##  w      : Frequency (vector)
##  x      : Free variable (vector) 
##
## Returns inverse transform, f
##
## Copyright (C), 2014, Jesper Hansen. 
## See the COPYING file for license agreements.
##

function f = ifltrans(freq, F, x)
 
  if( isvector(F) != 1 || isvector(freq) != 1 )
    error("sft: 1 and 2 argument must be vectors");
  elseif ( length(freq) != length(F) )
    error("sft: Length of first  and second argument must be the same");
  endif
       
  if ( rows(F) != 1 )
    F = F';
  endif 
  if ( rows(freq) != 1 )
    freq = freq';
  endif 

  l = length(x);  

  f_real = zeros(l, 1);
  f_imag = zeros(l, 1);
  
  for n=1:l
    g = F.*exp(I*x(n).*freq);
    f(n) = trapz(I*freq, g);
  endfor
 
  f = f./(2*pi*I);
endfunction 
